/**
 * 
 */
package com.java.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.java.entity.Course;
import com.java.mapper.CourseMapper;
import com.java.mapper.FunctionMapper;
import com.java.service.CourseService;

/**
* @author Kidney
* 创建时间：2019年4月29日 下午3:08:58
* Description:
*/
/**
 * @author KIDNEY
 *
 */

@Service("CourseServiceImpl")
public class CourseServiceImpl implements CourseService{
	@Autowired
	private CourseMapper cm;
	
	/* (non-Javadoc)
	 * @see com.java.service.CourseService#getAll()
	 */
	@Override
	public List<Course> getAll() {
		// TODO Auto-generated method stub
		return cm.getAll();
	}

	/* (non-Javadoc)
	 * @see com.java.service.CourseService#delete(com.java.entity.Course)
	 */
	@Override
	public Integer delete(Integer courseid) {
		// TODO Auto-generated method stub
		return cm.deleteByPrimaryKey(courseid);
	}

	/* (non-Javadoc)
	 * @see com.java.service.CourseService#update(com.java.entity.Course)
	 */
	@Override
	public Integer update(Course course) {
		// TODO Auto-generated method stub
		return cm.updateByPrimaryKeySelective(course);
	}

	/* (non-Javadoc)
	 * @see com.java.service.CourseService#insert(com.java.entity.Course)
	 */
	@Override
	public Integer insert(Course course) {
		// TODO Auto-generated method stub
		return cm.insertSelective(course);
	}

	/* (non-Javadoc)
	 * @see com.java.service.CourseService#byCondition(java.lang.String, java.lang.Integer, java.lang.Integer)
	 */
	@Override
	public List<Course> byCondition(String courseName, Integer courseid, Integer collegeid) {
		// TODO Auto-generated method stub
		Course course = new Course();
		course.setCourseid(courseid);
		course.setCollegeid(collegeid);
		course.setCoursename(courseName);
		
		return cm.selectByCondition(course);
	}

	/* (non-Javadoc)
	 * @see com.java.service.CourseService#byTeacher(java.lang.Integer)
	 */
	@Override
	public List<Course> byTeacher(Integer teacherId) {
		// TODO Auto-generated method stub
				Course course = new Course();
			course.setTeacherid(teacherId);
		return cm.selectByTeacher(course);
	}

}
